package com.mccken.designpattern.strategy.strategy_02;

import com.mccken.designpattern.strategy.strategy_02.sub_srategy.ChildrenStrategy;
import com.mccken.designpattern.strategy.strategy_02.sub_srategy.CouponStrategy;
import com.mccken.designpattern.strategy.strategy_02.sub_srategy.EmptyStrategy;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2024-01-14 20:42
 **/
public class Client02 {

	public static void main(String[] args) {
//		demo1();
	}
	
	public static void demo1() {
		PromotionActivity promotionActivity1 = new PromotionActivity(new EmptyStrategy());
		PromotionActivity promotionActivity2 = new PromotionActivity(new CouponStrategy());
		PromotionActivity promotionActivity3 = new PromotionActivity(new ChildrenStrategy());
		promotionActivity1.execute(50);
		promotionActivity3.execute(50);
		promotionActivity2.execute(50);
	}
	
	public static void demo2() {
		PromotionActivity promotionActivity = null;
		//  从apollo上或者是用户选择优惠券
		String promotionKey = getPromotionKey();
		
		if ("COUPON".equalsIgnoreCase(promotionKey)) {
			promotionActivity = new PromotionActivity(new CouponStrategy());	
		} else {
			promotionActivity = new PromotionActivity(new EmptyStrategy());
		}
		
		promotionActivity.execute(50);
		
	}
	
	private static String getPromotionKey() {
		return "COUPON";
	}
}
